package com.bridge.bridge_login;

import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;

import androidx.annotation.NonNull;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.bridge.bridge_login.databinding.AcGuideBinding;
import com.bridge.common.base.BaseActivity;
import com.bridge.common.route.RouteUtils;

/**
 * author : bridge.24
 * date   : 21.3.123:34
 * desc   :
 */
@Route(path = "/bridge_login/GuideActivity")
public class GuideActivity extends BaseActivity {
    private AcGuideBinding binding ;
    private int count = 3;
    Handler handler = new Handler() {
        @Override
        public void handleMessage(@NonNull Message msg) {
            super.handleMessage(msg);
            if (msg.what == 0) {
                count--;
                if (count >= 0) {
                    binding.tvMs.setText(TextUtils.concat(String.valueOf(count), "s"));
                }
                if (count == 1) {
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                            turnToActivity(LoginActivity.class);
                            finish();
                        }
                    });
                }
                sendEmptyMessageDelayed(0, 1000);
            }
        }
    };
    @Override
    protected int layoutId() {
        return R.layout.ac_guide;
    }

    @Override
    protected void initView() {
        binding = getBind() ;
        Log.e("dongnao", "initView: ===");
        handler.sendEmptyMessageDelayed(0, 1000);
    }

    @Override
    protected void setListenner() {

    }
}
